<template>
  <div class="notice-editor-wrapper">
    <a-row type="flex" class="topline">
      <a-icon type="left" style="font-size:20px;position" @click="goback" />
      <div class="left2" style="cursor:pointer;" @click="goback">返回</div>
      <h3>详情</h3>
      <a-icon type="add" />
    </a-row>
    <div class="ql-editor-content">
      <div class="preview-new-box">
        <div class="notice-content">
          <div class="notice-company-title">{{ currentNew.title }}</div>
          <div class="notice-company-date">发布时间：{{ currentNew.gmtCreate | formatDateAll() }}</div>
          <div class="notice-company-content" v-html="currentNew.contentHasStyle" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { formatDateAll } from "@/utils/index";
import { getNewDetail } from "@/api/company/news";
export default {
  name: "Detail",
  filters: {
    formatDateAll
  },
  data() {
    return {
      newId: "",
      currentNew: "",
      companyId: ""
    };
  },

  created() {
    this.companyId = this.$store.state.hr.companyId;
    this.newId = this.$route.query.id;
    this.getNewDetail(this.newId);
  },
  methods: {
    goback() {
      this.$router.go(-1);
    },
    getNewDetail(newId) {
      getNewDetail({ newsTypeId: newId }).then(res => {
        this.currentNew = res.data;
      });
    }
  }
};
</script>
<style lang="scss">
.left2 {
  z-index: 3;
  left: 50px;
  position: absolute;
  color: #595959;
  font-size: 16px;
}
.topset {
  display: flex;
  align-items: center;
}
.notice-editor-wrapper {
  margin: 20px;
  padding-bottom: 20px;
  .preview-new-box {
    width: 99%;
    height: 600px;
    overflow: auto;
    .notice-company-title {
      text-align: center;
      font-size: 24px;
      font-weight: 400;
      color: rgba(64, 64, 64, 1);
    }
    .notice-company-date {
      display: block;
      margin: 0 auto;
      width: 600px;
      text-align: center;
      font-size: 14px;
      color: rgba(102, 102, 102, 1);
    }
  }
}
</style>
